<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
    <div class="layui-card-body padding-left-40">
        <div class="layui-form-item">
            <label class="relative block">
                <span class="color-green font-w7">数据表</span>
                <select class='layui-select' name="table" lay-search>
                    <!--{foreach $tables as $k=>$v}-->
                    <!--{eq name='v' value='$vo.table|default=""'}-->
                    <option selected value='{$v}'>{$v}</option>
                    <!--{else}-->
                    <option value='{$v}'>{$v}</option>
                    <!--{/eq}-->
                    <!--{/foreach}-->
                </select>
            </label>
        </div>
        <div class="layui-form-item">
            <span class="relative block">
                <span class="color-green font-w7">抄送人</span>
                <div id="cc_man" onclick="btn_click()"></div>
            </label>
        </div>
        {notempty name='users'}
        <div class="layui-form-item relative">
            <span class="color-green font-w7">一级审批人</span>
            <div class="layui-textarea">
                {foreach $users as $user}
                <label class="think-checkbox layui-unselect">
                    {if in_array($user.id, $vo.one_check)}
                    <input type="checkbox" checked name="one_check[]" value="{$user.id}" lay-ignore> {$user.name}
                    {else}
                    <input type="checkbox" name="one_check[]" value="{$user.id}" lay-ignore> {$user.name}
                    {/if}
                </label>
                {/foreach}
            </div>
        </div>
        {/notempty}
        {notempty name='users'}
        <div class="layui-form-item relative">
            <span class="color-green font-w7">二级审批人</span>
            <div class="layui-textarea">
                {foreach $users as $user}
                <label class="think-checkbox layui-unselect">
                    {if in_array($user.id, $vo.two_check)}
                    <input type="checkbox" checked name="two_check[]" value="{$user.id}" lay-ignore> {$user.name}
                    {else}
                    <input type="checkbox" name="two_check[]" value="{$user.id}" lay-ignore> {$user.name}
                    {/if}
                </label>
                {/foreach}
            </div>
        </div>
        {/notempty}
        {notempty name='users'}
        <div class="layui-form-item relative">
            <span class="color-green font-w7">三级审批人</span>
            <div class="layui-textarea">
                {foreach $users as $user}
                <label class="think-checkbox layui-unselect">
                    {if in_array($user.id, $vo.three_check)}
                    <input type="checkbox" checked name="three_check[]" value="{$user.id}" lay-ignore> {$user.name}
                    {else}
                    <input type="checkbox" name="three_check[]" value="{$user.id}" lay-ignore> {$user.name}
                    {/if}
                </label>
                {/foreach}
            </div>
        </div>
        {/notempty}
    </div>

    <div class="hr-line-dashed"></div>
    {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}

    <div class="layui-form-item text-center">
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
    </div>

</form>
<script>
    form.render()
    var course_ware = xmSelect.render({
            el: '#cc_man',
            //文字背景颜色
            theme: {
                color: '#1cbbb4',
            },
            //全选清空辅助按钮
            toolbar: { show: true },
            //提交的name名
            name: 'cc_man',
            //提示信息
            tips: '请选择抄送人员',
            //开启搜索
            filterable: true,
            //分页
            paging: true,
            pageSize: 10,
            height: 'auto',
            //自动换行
            autoRow: true,
            //自定义数据匹配key名称
            prop: {
                name: 'name',
                value: 'id',
                // children: 'children',
            },
            data: []
        })
        var select = '{$vo.cc_man??""}';
        var select = select.split(',');
        $.get('{:url("get_susers")}',{},
            function (res) {
                //渲染默认列表数据
                course_ware.update({
                    data: res.data,
                    autoRow: true,
                })
                //渲染已经选择的标签
                course_ware.setValue(select);
            }
        );
</script>
